namespace Hospital.API.Dto
{
    /// <summary>
    /// 开单记录查询DTO
    /// </summary>
    public class OrderRecordQueryDto
    {
        /// <summary>
        /// 患者姓名
        /// </summary>
        public string? PatientName { get; set; }

        /// <summary>
        /// 院区ID
        /// </summary>
        public int? HospitalBranchId { get; set; }

        /// <summary>
        /// 支付状态：全部、待审核、已审核、已取消、已支付、已完成
        /// </summary>
        public string? PaymentStatus { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 当前页数
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页数量
        /// </summary>
        public int PageSize { get; set; } = 10;
    }

    /// <summary>
    /// 创建开单申请DTO
    /// </summary>
    public class CreateOrderRecordDto
    {
        /// <summary>
        /// 患者姓名
        /// </summary>

        public string PatientName { get; set; } = string.Empty;

        /// <summary>
        /// 患者身份证号
        /// </summary>

        public string PatientIdCard { get; set; } = string.Empty;

        /// <summary>
        /// 院区ID
        /// </summary>

        public int HospitalBranchId { get; set; }

        /// <summary>
        /// 申请原因
        /// </summary>
 
        public string ApplicationReason { get; set; } = string.Empty;

        /// <summary>
        /// 申请项目列表
        /// </summary>

        public List<OrderItemDto> Items { get; set; } = new List<OrderItemDto>();
    }

    /// <summary>
    /// 开单项目DTO
    /// </summary>
    public class OrderItemDto
    {
        /// <summary>
        /// 检查项目ID
        /// </summary>

        public int CheckItemId { get; set; }

        /// <summary>
        /// 数量
        /// </summary>

        public int Quantity { get; set; } = 1;
    }

    /// <summary>
    /// 开单记录详情DTO
    /// </summary>
    public class OrderRecordDetailDto
    {
        /// <summary>
        /// 开单记录ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 患者姓名
        /// </summary>
        public string PatientName { get; set; } = string.Empty;

        /// <summary>
        /// 患者身份证号
        /// </summary>
        public string PatientIdCard { get; set; } = string.Empty;

        /// <summary>
        /// 院区名称
        /// </summary>
        public string HospitalBranchName { get; set; } = string.Empty;

        /// <summary>
        /// 申请原因
        /// </summary>
        public string ApplicationReason { get; set; } = string.Empty;

        /// <summary>
        /// 支付状态
        /// </summary>
        public string PaymentStatus { get; set; } = string.Empty;

        /// <summary>
        /// 开单金额
        /// </summary>
        public decimal TotalAmount { get; set; }

        /// <summary>
        /// 开单时间
        /// </summary>
        public DateTime OrderTime { get; set; }

        /// <summary>
        /// 支付时间
        /// </summary>
        public DateTime? PaymentTime { get; set; }

        /// <summary>
        /// 完成时间
        /// </summary>
        public DateTime? CompletedTime { get; set; }

        /// <summary>
        /// 申请项目列表
        /// </summary>
        public List<OrderItemDetailDto> Items { get; set; } = new List<OrderItemDetailDto>();
    }

    /// <summary>
    /// 开单项目详情DTO
    /// </summary>
    public class OrderItemDetailDto
    {
        /// <summary>
        /// 检查项目名称
        /// </summary>
        public string CheckItemName { get; set; } = string.Empty;

        /// <summary>
        /// 项目类型名称
        /// </summary>
        public string TypeName { get; set; } = string.Empty;

        /// <summary>
        /// 数量
        /// </summary>
        public int Quantity { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal UnitPrice { get; set; }

        /// <summary>
        /// 小计
        /// </summary>
        public decimal SubTotal { get; set; }
    }

    /// <summary>
    /// 更新支付状态DTO
    /// </summary>
    public class UpdatePaymentStatusDto
    {
        /// <summary>
        /// 开单记录ID
        /// </summary>

        public int OrderRecordId { get; set; }

        /// <summary>
        /// 支付状态
        /// </summary>
        public string PaymentStatus { get; set; } = string.Empty;

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }
    }

    /// <summary>
    /// 已选项目详情DTO
    /// </summary>
    public class SelectedItemDetailDto
    {
        /// <summary>
        /// 项目ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 价格
        /// </summary>
        public decimal Price { get; set; }

        /// <summary>
        /// 类型名称
        /// </summary>
        public string TypeName { get; set; } = string.Empty;

        /// <summary>
        /// 类型编码
        /// </summary>
        public string TypeCode { get; set; } = string.Empty;

        /// <summary>
        /// 检查目的
        /// </summary>
        public string? Purpose { get; set; }

        /// <summary>
        /// 注意事项
        /// </summary>
        public string? Precautions { get; set; }
    }

    /// <summary>
    /// 订单摘要DTO
    /// </summary>
    public class OrderSummaryDto
    {
        /// <summary>
        /// 总项目数量
        /// </summary>
        public int TotalItems { get; set; }

        /// <summary>
        /// 总金额
        /// </summary>
        public decimal TotalAmount { get; set; }

        /// <summary>
        /// 项目列表
        /// </summary>
        public List<OrderItemSummaryDto> Items { get; set; } = new List<OrderItemSummaryDto>();
    }

    /// <summary>
    /// 订单项目摘要DTO
    /// </summary>
    public class OrderItemSummaryDto
    {
        /// <summary>
        /// 项目ID
        /// </summary>
        public int ItemId { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string ItemName { get; set; } = string.Empty;

        /// <summary>
        /// 项目类型
        /// </summary>
        public string ItemType { get; set; } = string.Empty;

        /// <summary>
        /// 单价
        /// </summary>
        public decimal UnitPrice { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public int Quantity { get; set; }

        /// <summary>
        /// 总价
        /// </summary>
        public decimal TotalPrice { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string Unit { get; set; } = string.Empty;
    }
} 